{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "8ac547b0-f30e-4714-84a6-086972495982",
   "metadata": {},
   "source": [
    "# Inference with pre-trained models\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9ecfe39a-811d-4b4c-b922-6f2e40489d0c",
   "metadata": {},
   "source": [
    "## Installation\n",
    "\n",
    "```\n",
    "pip install openmim, mmengine\n",
    "mim install mmcv>=2.0.0rc mmcls>=1.0.0rc\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3854d1b6-3e1b-4fce-83e1-29bdbd7cc92e",
   "metadata": {},
   "source": [
    "## Config and Checkpoint File\n",
    "\n",
    "**Config file**\n",
    "\n",
    "All items required to define a training *experiment*, including\n",
    "\n",
    "- model\n",
    "- dataset and data augmentation pipeline\n",
    "- training algorithms and learning rate policies\n",
    "- runtime config of the program\n",
    "\n",
    "**Checkpoint file**\n",
    "\n",
    "A pytorch `pth` file, containing the `state_dict` of a model as well as some meta information.\n",
    "A checkpoint file is usually trained from a config file, using the toolbox.\n",
    "\n",
    "We can navigate to [home page](https://github.com/open-mmlab/mmclassification) to select a model\n",
    "and download corresponding config & checkpoint file using `mim`.\n",
    "\n",
    "```\n",
    "mim download mmcls --config mobilenet-v2_8xb32_in1k --dest . \n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4c1fc120-c57c-47e6-a75e-5f83ba603400",
   "metadata": {},
   "source": [
    "## Inference using high-level API"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0439471a",
   "metadata": {},
   "outputs": [
    {
     "ename": "ImportError",
     "evalue": "cannot import name 'register_all_modules' from 'mmcls.utils' (/home/cine/mmclassification/mmcls/utils/__init__.py)",
     "output_type": "error",
     "traceback": [
      "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[0;31mImportError\u001B[0m                               Traceback (most recent call last)",
      "Cell \u001B[0;32mIn[2], line 2\u001B[0m\n\u001B[1;32m      1\u001B[0m \u001B[38;5;66;03m# Necessary to register all modules\u001B[39;00m\n\u001B[0;32m----> 2\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mmmcls\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mutils\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m register_all_modules\n\u001B[1;32m      3\u001B[0m register_all_modules()\n",
      "\u001B[0;31mImportError\u001B[0m: cannot import name 'register_all_modules' from 'mmcls.utils' (/home/cine/mmclassification/mmcls/utils/__init__.py)"
     ]
    }
   ],
   "source": [
    "# Necessary to register all modules\n",
    "from mmcls.utils import register_all_modules\n",
    "register_all_modules()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "636f9aa5-1996-436b-a6a4-61de6b88244b",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/cine/miniconda3/envs/mmlab1/lib/python3.8/site-packages/mmcv/__init__.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details.\n",
      "  warnings.warn(\n"
     ]
    }
   ],
   "source": [
    "from mmcls.apis import init_model, inference_model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2c9daa23-0658-4331-8767-907fa7effa53",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "local loads checkpoint from path: mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\wangruohui\\Miniconda3\\envs\\mm2\\lib\\site-packages\\mmcls\\apis\\inference.py:45: UserWarning: Class names are not saved in the checkpoint's meta data, use imagenet by default.\n",
      "  warnings.warn('Class names are not saved in the checkpoint\\'s '\n"
     ]
    }
   ],
   "source": [
    "model = init_model('mobilenet-v2_8xb32_in1k.py', \n",
    "                   'mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth', \n",
    "                   device='cuda:0')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "dcbdc58f-674f-4c2e-9fa1-04f7fdf2cb6a",
   "metadata": {},
   "outputs": [],
   "source": [
    "result = inference_model(model, 'banana.png')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e649ed6b-ca9a-4eb5-b1a1-098309022330",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'pred_label': 954, 'pred_score': 0.9999284744262695, 'pred_class': 'banana'}"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d86b9275-df6e-49b2-935b-1a4396a88b7b",
   "metadata": {},
   "source": [
    "## PyTorch codes under the hood\n",
    "\n",
    "Let write some raw PyTorch codes to do the same thing. \n",
    "\n",
    "These are actual codes wrapped in high-level APIs."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c9c9537f-3b60-4615-a13e-ad5376c184b9",
   "metadata": {},
   "source": [
    "### construct an `ImageClassifier`\n",
    "\n",
    "Note: current implementation only allow configs of backbone, neck and classification head instead of Python objects. \n",
    "\n",
    "If you want to play with components you can construct them indivisually or fetch them as members of the constructed `ImageClassifier` object. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "15ead765-0830-42bf-9260-62382732cf67",
   "metadata": {},
   "outputs": [],
   "source": [
    "from mmcls.models import ImageClassifier\n",
    "\n",
    "classifier = ImageClassifier(\n",
    "    backbone=dict(type='MobileNetV2', widen_factor=1.0),\n",
    "    neck=dict(type='GlobalAveragePooling'),\n",
    "    head=dict(\n",
    "        type='LinearClsHead',\n",
    "        num_classes=1000,\n",
    "        in_channels=1280)\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c4743036-aa6f-4cdb-9a2a-9bdb629e9762",
   "metadata": {},
   "source": [
    "### Load trained parameters"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "43d1a6ce-5ef5-4d63-9432-e801f0f549ed",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<All keys matched successfully>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import torch\n",
    "\n",
    "ckpt = torch.load('mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth')\n",
    "classifier.load_state_dict(ckpt['state_dict'])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "178717fa-61b8-4625-aab0-66ded0c909d4",
   "metadata": {
    "tags": []
   },
   "source": [
    "### Construct data preprocessing pipeline\n",
    "\n",
    "**Important**: A models work only if image preprocessing pipelines is correct."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "a24f830e-24e6-46b0-a3da-c80885ae9b1e",
   "metadata": {},
   "outputs": [],
   "source": [
    "from mmcv.transforms import Compose\n",
    "\n",
    "test_pipeline = Compose([\n",
    "    dict(type='LoadImageFromFile'),\n",
    "    dict(type='ResizeEdge', scale=256, edge='short', backend='pillow'),\n",
    "    dict(type='CenterCrop', crop_size=224),\n",
    "    dict(type='PackClsInputs')\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "03aaca7e-9e92-449d-ad0e-7ed7b301326b",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = dict(img_path='banana.png')\n",
    "data = test_pipeline(data)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1c250d19-b532-4b5e-ad1f-3d0aa5ccc686",
   "metadata": {},
   "source": [
    "#### equivalent in `torchvision` "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "69ccee55-1bad-489d-ad12-1f72d2e27702",
   "metadata": {},
   "outputs": [],
   "source": [
    "from PIL import Image\n",
    "from torchvision.transforms import Compose, Resize, CenterCrop, Normalize, ToTensor\n",
    "\n",
    "tv_transform = Compose([Resize(256), \n",
    "                        CenterCrop(224), \n",
    "                        ToTensor(),\n",
    "                        Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])\n",
    "                        ])\n",
    "\n",
    "image = Image.open('banana.png').convert('RGB')\n",
    "tv_data = tv_transform(image)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "83ec3109-3b59-4c05-b806-c1a2f85ab2b0",
   "metadata": {},
   "source": [
    "### Forward through the model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "c631735e-b457-480c-b853-39a49ae66ac8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1000\n",
      "[<ClsDataSample(\n",
      "\n",
      "    META INFORMATION\n",
      "\n",
      "    DATA FIELDS\n",
      "    pred_label: <LabelData(\n",
      "        \n",
      "            META INFORMATION\n",
      "            num_classes: 1000\n",
      "        \n",
      "            DATA FIELDS\n",
      "            label: tensor([954])\n",
      "            score: tensor([8.7886e-11, 1.4862e-10, 7.9490e-10, 7.5087e-10, 2.3911e-08, 1.4624e-08,\n",
      "                        1.6622e-09, 8.6278e-09, 2.2922e-08, 2.8606e-11, 1.8818e-09, 8.1963e-09,\n",
      "                        4.3835e-09, 1.3013e-09, 6.0647e-10, 1.4825e-09, 9.7490e-09, 2.1946e-09,\n",
      "                        1.4078e-08, 2.6998e-10, 9.2191e-11, 4.0907e-10, 2.5204e-09, 1.3026e-08,\n",
      "                        5.2355e-11, 1.9043e-09, 7.6891e-09, 2.0430e-09, 6.6810e-10, 9.5962e-09,\n",
      "                        1.0180e-09, 1.2636e-08, 2.4030e-09, 1.6970e-09, 1.1531e-09, 8.5339e-10,\n",
      "                        1.4433e-08, 7.8068e-10, 3.7663e-10, 8.6339e-10, 1.3663e-08, 3.3271e-10,\n",
      "                        2.1759e-10, 6.4700e-11, 2.0980e-10, 8.3660e-10, 5.2944e-09, 8.7994e-11,\n",
      "                        1.5536e-09, 1.8024e-10, 3.1378e-09, 4.4230e-10, 8.2233e-08, 8.2324e-09,\n",
      "                        6.1275e-09, 6.1965e-09, 7.9206e-09, 1.4232e-10, 8.4630e-09, 5.8783e-08,\n",
      "                        3.1549e-08, 6.2044e-09, 2.1706e-09, 1.5774e-08, 4.1221e-08, 5.0902e-08,\n",
      "                        1.4180e-07, 1.4414e-10, 1.0394e-08, 1.9239e-11, 4.6797e-10, 4.1039e-09,\n",
      "                        5.2671e-10, 9.2051e-10, 1.7488e-09, 7.0525e-11, 1.2417e-10, 1.6927e-10,\n",
      "                        1.1270e-09, 6.9277e-10, 8.7289e-09, 1.9589e-08, 2.2030e-09, 2.0725e-09,\n",
      "                        3.9250e-10, 1.2031e-08, 1.8385e-09, 1.4620e-09, 6.0243e-09, 1.0932e-06,\n",
      "                        1.1039e-09, 2.8575e-10, 9.2065e-11, 9.9042e-08, 2.7138e-08, 6.9576e-11,\n",
      "                        4.5470e-09, 2.8546e-08, 1.6601e-11, 7.4378e-09, 9.2598e-10, 1.4410e-11,\n",
      "                        3.6995e-10, 1.1474e-08, 4.1627e-10, 1.0300e-09, 3.1033e-11, 1.0555e-09,\n",
      "                        5.3624e-09, 1.0980e-10, 1.2894e-06, 2.9104e-08, 5.3340e-07, 1.2154e-07,\n",
      "                        7.1918e-07, 1.9071e-07, 2.0188e-09, 9.1509e-08, 1.7234e-09, 4.3385e-09,\n",
      "                        7.0848e-09, 1.6945e-09, 4.3268e-10, 2.9743e-10, 6.5571e-11, 7.2899e-09,\n",
      "                        2.2067e-09, 9.3366e-11, 4.7672e-10, 8.9961e-10, 6.7792e-11, 3.9216e-10,\n",
      "                        1.2531e-09, 5.7611e-11, 1.3663e-10, 4.1406e-10, 1.3812e-09, 1.1521e-08,\n",
      "                        1.8078e-11, 1.2583e-09, 2.5999e-10, 8.3584e-11, 2.3035e-09, 1.6363e-09,\n",
      "                        2.0160e-09, 6.7772e-09, 4.5085e-07, 6.6183e-11, 2.3476e-09, 5.8951e-10,\n",
      "                        5.5549e-08, 1.3273e-09, 5.6719e-10, 1.1951e-09, 1.0490e-09, 6.6654e-09,\n",
      "                        2.6564e-11, 9.0018e-11, 1.9421e-10, 1.6838e-09, 1.4094e-09, 7.7531e-10,\n",
      "                        5.4881e-10, 1.5135e-10, 1.6485e-10, 1.7010e-11, 7.2581e-10, 6.7432e-10,\n",
      "                        3.7612e-10, 3.8149e-10, 5.0962e-09, 1.4318e-10, 1.1669e-08, 4.6787e-10,\n",
      "                        2.2173e-10, 3.4451e-11, 1.0542e-09, 1.5969e-09, 3.5583e-10, 3.5144e-10,\n",
      "                        1.0427e-09, 1.9744e-10, 4.6482e-10, 3.7827e-09, 2.3047e-09, 3.6117e-09,\n",
      "                        1.0041e-08, 7.1243e-10, 5.6784e-10, 4.2954e-09, 1.9187e-09, 3.8906e-10,\n",
      "                        1.3749e-08, 2.3365e-09, 3.5755e-10, 1.8780e-09, 3.1871e-09, 5.2232e-09,\n",
      "                        1.5567e-09, 1.6065e-09, 1.8628e-09, 5.0227e-10, 1.9931e-08, 2.7492e-09,\n",
      "                        7.3811e-09, 3.4734e-10, 3.8238e-10, 1.4435e-09, 3.2705e-09, 1.2688e-09,\n",
      "                        4.1160e-09, 2.2333e-10, 6.7910e-09, 1.3242e-10, 6.8104e-11, 1.4711e-10,\n",
      "                        1.7752e-10, 3.6610e-08, 2.4470e-11, 3.3356e-09, 3.1809e-10, 5.1972e-10,\n",
      "                        9.7691e-10, 9.9512e-10, 3.5494e-09, 9.2426e-10, 1.3916e-08, 3.6187e-10,\n",
      "                        9.6441e-11, 1.6520e-10, 1.4349e-10, 2.6405e-09, 4.2412e-10, 1.1356e-08,\n",
      "                        2.3377e-10, 7.1066e-10, 3.4803e-10, 2.3804e-10, 5.9703e-10, 3.8834e-10,\n",
      "                        1.0943e-09, 8.7445e-10, 1.4579e-08, 1.1876e-09, 4.6010e-10, 1.4305e-08,\n",
      "                        6.7089e-08, 1.1366e-08, 3.0466e-09, 5.6568e-09, 1.4281e-09, 6.5859e-08,\n",
      "                        1.3842e-09, 1.4763e-08, 8.2839e-09, 2.7768e-10, 1.3607e-09, 3.5910e-10,\n",
      "                        2.6382e-09, 3.4978e-09, 3.4523e-10, 1.2247e-10, 1.2895e-10, 2.1239e-10,\n",
      "                        1.6338e-09, 2.1831e-09, 2.6187e-11, 3.9741e-10, 2.9356e-09, 1.6012e-10,\n",
      "                        3.9751e-10, 8.9792e-11, 1.1645e-10, 6.2550e-10, 9.6461e-12, 5.6063e-10,\n",
      "                        1.1870e-10, 2.0127e-10, 2.0227e-10, 1.1025e-08, 2.8645e-10, 1.4348e-08,\n",
      "                        1.2959e-09, 1.1764e-09, 1.0246e-08, 1.8105e-08, 2.5372e-10, 3.8008e-10,\n",
      "                        1.0098e-09, 5.9484e-10, 2.1735e-10, 2.5824e-10, 1.0826e-10, 1.5196e-10,\n",
      "                        3.5422e-10, 2.8941e-10, 2.7199e-09, 1.6698e-11, 1.1201e-09, 4.4053e-09,\n",
      "                        2.0259e-12, 5.5604e-09, 1.0338e-11, 2.3359e-10, 4.2704e-10, 3.2729e-11,\n",
      "                        2.4129e-08, 2.4407e-09, 7.8883e-11, 1.8901e-08, 5.4393e-09, 3.5589e-09,\n",
      "                        7.1579e-09, 1.2304e-09, 6.0962e-11, 3.9659e-08, 3.9177e-10, 4.1588e-09,\n",
      "                        2.8072e-10, 9.4088e-11, 7.7761e-11, 2.1208e-11, 1.7014e-11, 8.2274e-10,\n",
      "                        9.3323e-10, 5.8844e-10, 4.4671e-11, 6.4292e-09, 2.6979e-10, 1.6349e-08,\n",
      "                        2.5164e-10, 2.1025e-09, 3.4862e-10, 8.3876e-10, 2.1007e-10, 1.1716e-10,\n",
      "                        4.6896e-11, 2.2205e-10, 1.9448e-10, 3.6714e-11, 1.3454e-10, 4.4544e-11,\n",
      "                        1.6518e-11, 9.7574e-12, 3.7597e-10, 2.4004e-10, 4.1183e-12, 2.1350e-12,\n",
      "                        2.4305e-11, 2.9702e-11, 5.1578e-12, 7.2327e-12, 2.1965e-11, 4.3448e-11,\n",
      "                        2.4893e-10, 2.0807e-10, 3.5032e-09, 1.3452e-09, 1.8170e-09, 8.4222e-09,\n",
      "                        5.0383e-11, 2.9277e-10, 5.3525e-10, 1.5743e-10, 8.0684e-09, 1.2932e-10,\n",
      "                        2.7903e-10, 3.9934e-10, 1.6138e-09, 8.7043e-11, 1.1166e-10, 8.3915e-11,\n",
      "                        3.6726e-10, 1.0785e-10, 6.7516e-11, 2.8013e-11, 4.4043e-12, 2.2861e-10,\n",
      "                        3.5144e-10, 1.7984e-09, 2.7014e-10, 1.6687e-09, 2.6720e-10, 2.1855e-10,\n",
      "                        1.5937e-11, 3.2233e-11, 1.0866e-11, 1.5985e-11, 9.0966e-11, 5.7128e-11,\n",
      "                        5.1560e-07, 9.9439e-11, 1.2824e-09, 2.7764e-09, 2.5876e-11, 1.0428e-11,\n",
      "                        6.2474e-10, 1.1356e-10, 2.3011e-09, 5.3811e-09, 3.5557e-11, 1.5282e-11,\n",
      "                        1.6272e-09, 1.2595e-10, 2.1189e-10, 7.0355e-11, 6.3263e-10, 7.9112e-11,\n",
      "                        8.8506e-11, 1.3617e-09, 9.8890e-10, 1.3498e-10, 2.5953e-08, 3.7305e-11,\n",
      "                        9.4916e-11, 9.3362e-09, 1.4987e-09, 1.1246e-09, 7.0870e-11, 3.7025e-10,\n",
      "                        1.9177e-10, 1.5009e-07, 2.1428e-10, 1.8617e-10, 2.2247e-09, 2.1697e-12,\n",
      "                        1.4327e-07, 2.3880e-08, 7.5400e-09, 3.2200e-10, 5.7587e-10, 5.2384e-09,\n",
      "                        7.6385e-11, 1.3902e-10, 9.4123e-09, 3.7052e-07, 9.5871e-11, 3.4865e-10,\n",
      "                        1.9194e-08, 3.0423e-11, 9.9442e-09, 1.1764e-08, 1.9990e-09, 1.4270e-10,\n",
      "                        1.2207e-09, 6.7372e-09, 5.6668e-11, 9.7956e-11, 7.7461e-10, 2.5206e-12,\n",
      "                        6.4430e-11, 2.2185e-10, 3.5911e-10, 1.3559e-10, 5.9903e-10, 2.2046e-09,\n",
      "                        1.4139e-10, 3.8950e-10, 1.5170e-08, 1.4092e-09, 6.6414e-11, 3.5136e-09,\n",
      "                        4.1257e-08, 8.2085e-08, 1.7081e-09, 4.9953e-11, 2.0171e-11, 1.2572e-09,\n",
      "                        2.5088e-09, 4.0810e-09, 6.8963e-08, 9.7001e-10, 2.4902e-08, 2.4525e-08,\n",
      "                        5.0908e-11, 4.2762e-11, 6.5042e-09, 6.4010e-09, 2.8483e-09, 1.6876e-08,\n",
      "                        7.8352e-10, 6.0414e-11, 7.6314e-11, 2.8138e-10, 1.2328e-11, 6.9514e-11,\n",
      "                        1.4056e-10, 9.5773e-10, 3.4303e-08, 5.3990e-09, 5.5528e-10, 4.2010e-11,\n",
      "                        3.8349e-11, 3.1043e-10, 6.6416e-09, 8.2049e-10, 8.2007e-11, 1.2185e-11,\n",
      "                        1.0495e-10, 1.5494e-07, 1.0179e-10, 4.3759e-09, 6.5020e-06, 4.3252e-09,\n",
      "                        1.8538e-08, 5.6742e-08, 5.6552e-07, 2.0103e-09, 2.7373e-09, 1.3235e-10,\n",
      "                        6.5930e-11, 1.9144e-11, 5.8403e-08, 2.8942e-08, 3.1299e-08, 2.6330e-09,\n",
      "                        5.7060e-08, 8.3635e-10, 2.8468e-10, 2.9990e-09, 7.5186e-11, 1.5560e-09,\n",
      "                        2.5652e-10, 1.4422e-08, 2.1617e-10, 1.2071e-10, 1.8667e-10, 1.8028e-10,\n",
      "                        1.7247e-07, 1.1128e-09, 2.3489e-10, 2.2928e-10, 5.4406e-10, 1.0414e-09,\n",
      "                        5.9679e-10, 2.4117e-08, 4.2756e-12, 4.5020e-11, 1.0954e-10, 4.2461e-08,\n",
      "                        4.3185e-11, 1.1469e-09, 8.2571e-10, 6.0112e-10, 4.5804e-09, 3.3112e-08,\n",
      "                        8.7933e-09, 3.3623e-13, 2.7260e-11, 1.4559e-10, 3.8381e-10, 1.5728e-10,\n",
      "                        4.8054e-10, 7.8025e-10, 5.4906e-12, 2.3611e-10, 1.4490e-09, 4.2981e-09,\n",
      "                        5.2608e-09, 1.6851e-08, 3.2027e-11, 2.1794e-09, 3.9673e-08, 5.8257e-10,\n",
      "                        1.5349e-09, 9.9622e-11, 8.9449e-08, 2.5281e-07, 9.9172e-12, 6.8854e-11,\n",
      "                        3.0567e-09, 1.5613e-10, 4.2286e-07, 1.6151e-10, 5.9704e-09, 2.1351e-11,\n",
      "                        3.3938e-12, 2.5911e-09, 1.9829e-09, 1.8077e-10, 1.0796e-10, 1.1695e-09,\n",
      "                        4.2657e-09, 3.3592e-10, 6.3482e-09, 1.7508e-09, 5.3695e-11, 9.1582e-09,\n",
      "                        8.8203e-10, 2.1212e-08, 3.8788e-10, 1.5318e-08, 2.5164e-11, 2.5667e-10,\n",
      "                        3.6655e-09, 3.1583e-10, 3.3746e-08, 1.3673e-09, 7.9405e-13, 2.8601e-09,\n",
      "                        9.2503e-07, 7.3940e-09, 5.7676e-09, 9.8571e-11, 1.1255e-09, 1.6059e-10,\n",
      "                        6.3488e-09, 1.8630e-09, 4.2933e-09, 6.0921e-11, 5.2859e-11, 3.1138e-11,\n",
      "                        6.2277e-11, 2.0228e-09, 4.9058e-10, 3.8410e-10, 1.9653e-07, 9.1544e-10,\n",
      "                        4.3325e-07, 3.6290e-08, 5.9283e-10, 2.4265e-10, 1.8105e-11, 1.9664e-08,\n",
      "                        2.0110e-10, 2.8977e-12, 2.8953e-09, 4.8071e-11, 7.9511e-11, 3.0016e-10,\n",
      "                        4.2607e-07, 1.3521e-08, 8.9785e-10, 1.1866e-09, 1.8698e-11, 1.4613e-09,\n",
      "                        2.0701e-10, 3.6538e-10, 5.6412e-10, 7.8712e-10, 1.2317e-09, 1.6450e-07,\n",
      "                        2.0901e-10, 2.1323e-09, 9.8649e-09, 2.6229e-10, 1.0340e-08, 1.5433e-07,\n",
      "                        7.7166e-10, 1.4298e-11, 9.1605e-09, 4.0085e-10, 1.4156e-11, 5.5695e-09,\n",
      "                        9.5068e-11, 1.4022e-08, 2.5955e-10, 6.4778e-09, 3.2438e-10, 2.9416e-07,\n",
      "                        5.3999e-12, 4.4165e-11, 1.3117e-10, 6.3935e-10, 4.8900e-09, 3.6706e-08,\n",
      "                        1.8383e-06, 1.1528e-09, 5.5131e-11, 1.3114e-10, 1.7336e-08, 2.5319e-10,\n",
      "                        3.5100e-10, 6.4770e-10, 4.2503e-10, 9.6970e-11, 9.4506e-10, 1.2260e-09,\n",
      "                        2.0851e-09, 1.6473e-08, 3.4989e-07, 3.7521e-10, 2.2659e-11, 1.7785e-09,\n",
      "                        2.0704e-07, 4.1226e-11, 4.7494e-10, 2.5000e-10, 7.3404e-10, 4.6747e-09,\n",
      "                        8.5380e-12, 1.3447e-08, 3.3641e-10, 3.8482e-08, 1.9824e-12, 1.1277e-08,\n",
      "                        1.4410e-08, 8.3741e-09, 1.0047e-09, 9.4985e-09, 1.2366e-08, 5.6166e-10,\n",
      "                        2.0191e-09, 5.3750e-09, 2.3035e-09, 8.6422e-12, 6.2367e-10, 3.9367e-08,\n",
      "                        9.7779e-09, 1.8467e-11, 5.5082e-11, 7.9280e-09, 2.0550e-08, 6.2086e-11,\n",
      "                        2.5030e-10, 9.4806e-10, 1.4073e-09, 8.2167e-10, 3.0223e-10, 4.2000e-10,\n",
      "                        6.1048e-09, 1.2679e-09, 4.3404e-08, 3.2169e-09, 1.0791e-11, 2.6261e-06,\n",
      "                        5.2707e-10, 1.6470e-10, 2.3947e-10, 6.1520e-09, 1.3547e-09, 2.2801e-08,\n",
      "                        1.3057e-12, 2.2532e-09, 2.1066e-12, 1.1808e-10, 2.2422e-10, 3.9441e-09,\n",
      "                        5.2119e-07, 1.9170e-07, 2.0988e-09, 1.5213e-10, 1.9168e-11, 1.3430e-09,\n",
      "                        5.0347e-09, 5.9409e-12, 1.1721e-09, 3.4077e-10, 4.4798e-10, 7.1318e-10,\n",
      "                        3.9125e-11, 2.1642e-11, 1.2749e-09, 6.5107e-09, 1.5022e-10, 7.9540e-11,\n",
      "                        7.0555e-09, 1.9616e-11, 2.8065e-10, 4.1268e-12, 3.3638e-09, 3.8121e-10,\n",
      "                        1.3335e-09, 2.3972e-09, 3.8096e-10, 3.7802e-08, 5.9627e-11, 7.8959e-10,\n",
      "                        8.8755e-11, 4.5980e-09, 3.8252e-09, 5.6114e-09, 2.2566e-08, 5.5979e-08,\n",
      "                        4.0884e-08, 2.2632e-09, 4.7704e-09, 1.5967e-09, 2.7069e-07, 8.9959e-09,\n",
      "                        2.8314e-10, 8.6687e-13, 1.7089e-09, 1.0799e-09, 1.6137e-08, 3.7131e-10,\n",
      "                        3.1814e-10, 1.7255e-09, 3.6594e-08, 1.5092e-09, 2.0391e-09, 1.3289e-08,\n",
      "                        4.6916e-08, 2.8857e-09, 2.2752e-08, 2.0838e-10, 2.3824e-10, 1.9290e-10,\n",
      "                        5.9266e-10, 1.2575e-09, 1.4875e-12, 1.0104e-09, 1.9946e-11, 1.1080e-09,\n",
      "                        8.8880e-08, 5.9832e-10, 3.4026e-08, 9.5135e-10, 7.3775e-10, 7.1262e-08,\n",
      "                        1.3051e-10, 6.7043e-09, 1.7062e-10, 7.2376e-08, 5.5118e-11, 1.1635e-09,\n",
      "                        1.9766e-10, 1.9008e-11, 8.4608e-08, 2.9948e-11, 4.2769e-13, 3.4147e-12,\n",
      "                        4.2996e-09, 1.7012e-08, 6.2813e-10, 1.0345e-09, 1.9939e-09, 1.5677e-08,\n",
      "                        1.5597e-07, 1.3542e-11, 3.9192e-09, 1.5488e-08, 7.7585e-10, 1.1228e-10,\n",
      "                        9.0724e-10, 3.3413e-07, 2.3823e-10, 6.3847e-10, 6.8393e-09, 4.1247e-12,\n",
      "                        3.0462e-08, 3.0944e-10, 5.8460e-10, 6.2594e-08, 1.3905e-08, 5.5632e-09,\n",
      "                        8.6947e-09, 1.7184e-10, 2.2970e-11, 1.2398e-07, 5.6685e-10, 3.7461e-09,\n",
      "                        2.9900e-09, 5.8309e-11, 7.6376e-11, 3.1014e-09, 1.5507e-10, 6.9918e-09,\n",
      "                        7.4912e-08, 1.9565e-10, 9.6541e-10, 1.0460e-08, 4.4782e-09, 3.8818e-11,\n",
      "                        9.7592e-11, 1.1921e-10, 9.3363e-11, 5.3301e-12, 2.4253e-07, 1.5142e-10,\n",
      "                        3.8827e-08, 5.9628e-12, 3.3901e-10, 1.3101e-10, 2.6986e-12, 1.8315e-08,\n",
      "                        5.2576e-08, 2.9136e-10, 1.5314e-10, 1.0950e-08, 2.7612e-08, 7.5592e-10,\n",
      "                        3.2895e-09, 2.0139e-06, 4.0173e-09, 7.9455e-09, 2.3535e-11, 4.4485e-11,\n",
      "                        1.7583e-12, 4.6830e-11, 2.1056e-10, 1.8409e-09, 3.2729e-09, 1.3890e-11,\n",
      "                        4.3494e-11, 1.8824e-10, 9.5702e-07, 8.6986e-09, 2.5735e-08, 1.4306e-07,\n",
      "                        1.2765e-11, 5.2758e-08, 4.5231e-09, 1.5604e-10, 1.1184e-08, 3.3224e-09,\n",
      "                        1.4233e-10, 1.9803e-08, 3.6002e-10, 1.2086e-08, 1.5530e-07, 2.4564e-10,\n",
      "                        2.9484e-09, 4.4220e-12, 1.7426e-11, 2.5021e-11, 1.6461e-10, 5.1520e-11,\n",
      "                        8.2572e-10, 1.9292e-09, 1.3155e-10, 6.2904e-10, 3.3327e-10, 6.9456e-09,\n",
      "                        1.8285e-09, 1.2893e-09, 1.9672e-10, 2.0602e-09, 1.2926e-08, 1.3088e-09,\n",
      "                        3.6481e-09, 1.7666e-08, 6.1105e-08, 2.8380e-09, 1.1662e-08, 9.4395e-09,\n",
      "                        3.4944e-09, 3.7565e-07, 1.6100e-08, 1.1573e-06, 5.1676e-06, 6.6062e-07,\n",
      "                        4.4235e-06, 7.2685e-08, 3.8138e-08, 8.6665e-08, 3.5991e-10, 1.0953e-08,\n",
      "                        4.1678e-08, 1.8981e-08, 1.7448e-05, 7.5855e-06, 4.3588e-07, 9.0092e-07,\n",
      "                        9.9993e-01, 3.0438e-07, 7.7868e-08, 8.1716e-08, 1.5219e-11, 1.6423e-08,\n",
      "                        3.0094e-07, 5.1791e-08, 1.0623e-08, 4.7426e-11, 7.3046e-11, 1.8170e-09,\n",
      "                        5.7981e-09, 1.0674e-08, 3.4316e-08, 4.4206e-08, 2.2562e-10, 2.3125e-09,\n",
      "                        8.4880e-09, 5.0571e-10, 8.4950e-11, 6.3114e-09, 5.5009e-10, 4.6792e-08,\n",
      "                        4.0629e-08, 1.3391e-09, 2.9672e-09, 1.4919e-11, 5.1814e-10, 1.3520e-10,\n",
      "                        3.6802e-09, 1.3259e-08, 2.1610e-07, 1.1846e-07, 8.3192e-09, 7.1740e-09,\n",
      "                        2.5285e-08, 7.8507e-09, 3.7621e-10, 1.6768e-09, 1.4808e-11, 6.0783e-09,\n",
      "                        1.5095e-08, 5.5473e-09, 6.5910e-08, 1.5246e-09])\n",
      "        ) at 0x29f8fe121f0>\n",
      "    _pred_label: <LabelData(\n",
      "        \n",
      "            META INFORMATION\n",
      "            num_classes: 1000\n",
      "        \n",
      "            DATA FIELDS\n",
      "            label: tensor([954])\n",
      "            score: tensor([8.7886e-11, 1.4862e-10, 7.9490e-10, 7.5087e-10, 2.3911e-08, 1.4624e-08,\n",
      "                        1.6622e-09, 8.6278e-09, 2.2922e-08, 2.8606e-11, 1.8818e-09, 8.1963e-09,\n",
      "                        4.3835e-09, 1.3013e-09, 6.0647e-10, 1.4825e-09, 9.7490e-09, 2.1946e-09,\n",
      "                        1.4078e-08, 2.6998e-10, 9.2191e-11, 4.0907e-10, 2.5204e-09, 1.3026e-08,\n",
      "                        5.2355e-11, 1.9043e-09, 7.6891e-09, 2.0430e-09, 6.6810e-10, 9.5962e-09,\n",
      "                        1.0180e-09, 1.2636e-08, 2.4030e-09, 1.6970e-09, 1.1531e-09, 8.5339e-10,\n",
      "                        1.4433e-08, 7.8068e-10, 3.7663e-10, 8.6339e-10, 1.3663e-08, 3.3271e-10,\n",
      "                        2.1759e-10, 6.4700e-11, 2.0980e-10, 8.3660e-10, 5.2944e-09, 8.7994e-11,\n",
      "                        1.5536e-09, 1.8024e-10, 3.1378e-09, 4.4230e-10, 8.2233e-08, 8.2324e-09,\n",
      "                        6.1275e-09, 6.1965e-09, 7.9206e-09, 1.4232e-10, 8.4630e-09, 5.8783e-08,\n",
      "                        3.1549e-08, 6.2044e-09, 2.1706e-09, 1.5774e-08, 4.1221e-08, 5.0902e-08,\n",
      "                        1.4180e-07, 1.4414e-10, 1.0394e-08, 1.9239e-11, 4.6797e-10, 4.1039e-09,\n",
      "                        5.2671e-10, 9.2051e-10, 1.7488e-09, 7.0525e-11, 1.2417e-10, 1.6927e-10,\n",
      "                        1.1270e-09, 6.9277e-10, 8.7289e-09, 1.9589e-08, 2.2030e-09, 2.0725e-09,\n",
      "                        3.9250e-10, 1.2031e-08, 1.8385e-09, 1.4620e-09, 6.0243e-09, 1.0932e-06,\n",
      "                        1.1039e-09, 2.8575e-10, 9.2065e-11, 9.9042e-08, 2.7138e-08, 6.9576e-11,\n",
      "                        4.5470e-09, 2.8546e-08, 1.6601e-11, 7.4378e-09, 9.2598e-10, 1.4410e-11,\n",
      "                        3.6995e-10, 1.1474e-08, 4.1627e-10, 1.0300e-09, 3.1033e-11, 1.0555e-09,\n",
      "                        5.3624e-09, 1.0980e-10, 1.2894e-06, 2.9104e-08, 5.3340e-07, 1.2154e-07,\n",
      "                        7.1918e-07, 1.9071e-07, 2.0188e-09, 9.1509e-08, 1.7234e-09, 4.3385e-09,\n",
      "                        7.0848e-09, 1.6945e-09, 4.3268e-10, 2.9743e-10, 6.5571e-11, 7.2899e-09,\n",
      "                        2.2067e-09, 9.3366e-11, 4.7672e-10, 8.9961e-10, 6.7792e-11, 3.9216e-10,\n",
      "                        1.2531e-09, 5.7611e-11, 1.3663e-10, 4.1406e-10, 1.3812e-09, 1.1521e-08,\n",
      "                        1.8078e-11, 1.2583e-09, 2.5999e-10, 8.3584e-11, 2.3035e-09, 1.6363e-09,\n",
      "                        2.0160e-09, 6.7772e-09, 4.5085e-07, 6.6183e-11, 2.3476e-09, 5.8951e-10,\n",
      "                        5.5549e-08, 1.3273e-09, 5.6719e-10, 1.1951e-09, 1.0490e-09, 6.6654e-09,\n",
      "                        2.6564e-11, 9.0018e-11, 1.9421e-10, 1.6838e-09, 1.4094e-09, 7.7531e-10,\n",
      "                        5.4881e-10, 1.5135e-10, 1.6485e-10, 1.7010e-11, 7.2581e-10, 6.7432e-10,\n",
      "                        3.7612e-10, 3.8149e-10, 5.0962e-09, 1.4318e-10, 1.1669e-08, 4.6787e-10,\n",
      "                        2.2173e-10, 3.4451e-11, 1.0542e-09, 1.5969e-09, 3.5583e-10, 3.5144e-10,\n",
      "                        1.0427e-09, 1.9744e-10, 4.6482e-10, 3.7827e-09, 2.3047e-09, 3.6117e-09,\n",
      "                        1.0041e-08, 7.1243e-10, 5.6784e-10, 4.2954e-09, 1.9187e-09, 3.8906e-10,\n",
      "                        1.3749e-08, 2.3365e-09, 3.5755e-10, 1.8780e-09, 3.1871e-09, 5.2232e-09,\n",
      "                        1.5567e-09, 1.6065e-09, 1.8628e-09, 5.0227e-10, 1.9931e-08, 2.7492e-09,\n",
      "                        7.3811e-09, 3.4734e-10, 3.8238e-10, 1.4435e-09, 3.2705e-09, 1.2688e-09,\n",
      "                        4.1160e-09, 2.2333e-10, 6.7910e-09, 1.3242e-10, 6.8104e-11, 1.4711e-10,\n",
      "                        1.7752e-10, 3.6610e-08, 2.4470e-11, 3.3356e-09, 3.1809e-10, 5.1972e-10,\n",
      "                        9.7691e-10, 9.9512e-10, 3.5494e-09, 9.2426e-10, 1.3916e-08, 3.6187e-10,\n",
      "                        9.6441e-11, 1.6520e-10, 1.4349e-10, 2.6405e-09, 4.2412e-10, 1.1356e-08,\n",
      "                        2.3377e-10, 7.1066e-10, 3.4803e-10, 2.3804e-10, 5.9703e-10, 3.8834e-10,\n",
      "                        1.0943e-09, 8.7445e-10, 1.4579e-08, 1.1876e-09, 4.6010e-10, 1.4305e-08,\n",
      "                        6.7089e-08, 1.1366e-08, 3.0466e-09, 5.6568e-09, 1.4281e-09, 6.5859e-08,\n",
      "                        1.3842e-09, 1.4763e-08, 8.2839e-09, 2.7768e-10, 1.3607e-09, 3.5910e-10,\n",
      "                        2.6382e-09, 3.4978e-09, 3.4523e-10, 1.2247e-10, 1.2895e-10, 2.1239e-10,\n",
      "                        1.6338e-09, 2.1831e-09, 2.6187e-11, 3.9741e-10, 2.9356e-09, 1.6012e-10,\n",
      "                        3.9751e-10, 8.9792e-11, 1.1645e-10, 6.2550e-10, 9.6461e-12, 5.6063e-10,\n",
      "                        1.1870e-10, 2.0127e-10, 2.0227e-10, 1.1025e-08, 2.8645e-10, 1.4348e-08,\n",
      "                        1.2959e-09, 1.1764e-09, 1.0246e-08, 1.8105e-08, 2.5372e-10, 3.8008e-10,\n",
      "                        1.0098e-09, 5.9484e-10, 2.1735e-10, 2.5824e-10, 1.0826e-10, 1.5196e-10,\n",
      "                        3.5422e-10, 2.8941e-10, 2.7199e-09, 1.6698e-11, 1.1201e-09, 4.4053e-09,\n",
      "                        2.0259e-12, 5.5604e-09, 1.0338e-11, 2.3359e-10, 4.2704e-10, 3.2729e-11,\n",
      "                        2.4129e-08, 2.4407e-09, 7.8883e-11, 1.8901e-08, 5.4393e-09, 3.5589e-09,\n",
      "                        7.1579e-09, 1.2304e-09, 6.0962e-11, 3.9659e-08, 3.9177e-10, 4.1588e-09,\n",
      "                        2.8072e-10, 9.4088e-11, 7.7761e-11, 2.1208e-11, 1.7014e-11, 8.2274e-10,\n",
      "                        9.3323e-10, 5.8844e-10, 4.4671e-11, 6.4292e-09, 2.6979e-10, 1.6349e-08,\n",
      "                        2.5164e-10, 2.1025e-09, 3.4862e-10, 8.3876e-10, 2.1007e-10, 1.1716e-10,\n",
      "                        4.6896e-11, 2.2205e-10, 1.9448e-10, 3.6714e-11, 1.3454e-10, 4.4544e-11,\n",
      "                        1.6518e-11, 9.7574e-12, 3.7597e-10, 2.4004e-10, 4.1183e-12, 2.1350e-12,\n",
      "                        2.4305e-11, 2.9702e-11, 5.1578e-12, 7.2327e-12, 2.1965e-11, 4.3448e-11,\n",
      "                        2.4893e-10, 2.0807e-10, 3.5032e-09, 1.3452e-09, 1.8170e-09, 8.4222e-09,\n",
      "                        5.0383e-11, 2.9277e-10, 5.3525e-10, 1.5743e-10, 8.0684e-09, 1.2932e-10,\n",
      "                        2.7903e-10, 3.9934e-10, 1.6138e-09, 8.7043e-11, 1.1166e-10, 8.3915e-11,\n",
      "                        3.6726e-10, 1.0785e-10, 6.7516e-11, 2.8013e-11, 4.4043e-12, 2.2861e-10,\n",
      "                        3.5144e-10, 1.7984e-09, 2.7014e-10, 1.6687e-09, 2.6720e-10, 2.1855e-10,\n",
      "                        1.5937e-11, 3.2233e-11, 1.0866e-11, 1.5985e-11, 9.0966e-11, 5.7128e-11,\n",
      "                        5.1560e-07, 9.9439e-11, 1.2824e-09, 2.7764e-09, 2.5876e-11, 1.0428e-11,\n",
      "                        6.2474e-10, 1.1356e-10, 2.3011e-09, 5.3811e-09, 3.5557e-11, 1.5282e-11,\n",
      "                        1.6272e-09, 1.2595e-10, 2.1189e-10, 7.0355e-11, 6.3263e-10, 7.9112e-11,\n",
      "                        8.8506e-11, 1.3617e-09, 9.8890e-10, 1.3498e-10, 2.5953e-08, 3.7305e-11,\n",
      "                        9.4916e-11, 9.3362e-09, 1.4987e-09, 1.1246e-09, 7.0870e-11, 3.7025e-10,\n",
      "                        1.9177e-10, 1.5009e-07, 2.1428e-10, 1.8617e-10, 2.2247e-09, 2.1697e-12,\n",
      "                        1.4327e-07, 2.3880e-08, 7.5400e-09, 3.2200e-10, 5.7587e-10, 5.2384e-09,\n",
      "                        7.6385e-11, 1.3902e-10, 9.4123e-09, 3.7052e-07, 9.5871e-11, 3.4865e-10,\n",
      "                        1.9194e-08, 3.0423e-11, 9.9442e-09, 1.1764e-08, 1.9990e-09, 1.4270e-10,\n",
      "                        1.2207e-09, 6.7372e-09, 5.6668e-11, 9.7956e-11, 7.7461e-10, 2.5206e-12,\n",
      "                        6.4430e-11, 2.2185e-10, 3.5911e-10, 1.3559e-10, 5.9903e-10, 2.2046e-09,\n",
      "                        1.4139e-10, 3.8950e-10, 1.5170e-08, 1.4092e-09, 6.6414e-11, 3.5136e-09,\n",
      "                        4.1257e-08, 8.2085e-08, 1.7081e-09, 4.9953e-11, 2.0171e-11, 1.2572e-09,\n",
      "                        2.5088e-09, 4.0810e-09, 6.8963e-08, 9.7001e-10, 2.4902e-08, 2.4525e-08,\n",
      "                        5.0908e-11, 4.2762e-11, 6.5042e-09, 6.4010e-09, 2.8483e-09, 1.6876e-08,\n",
      "                        7.8352e-10, 6.0414e-11, 7.6314e-11, 2.8138e-10, 1.2328e-11, 6.9514e-11,\n",
      "                        1.4056e-10, 9.5773e-10, 3.4303e-08, 5.3990e-09, 5.5528e-10, 4.2010e-11,\n",
      "                        3.8349e-11, 3.1043e-10, 6.6416e-09, 8.2049e-10, 8.2007e-11, 1.2185e-11,\n",
      "                        1.0495e-10, 1.5494e-07, 1.0179e-10, 4.3759e-09, 6.5020e-06, 4.3252e-09,\n",
      "                        1.8538e-08, 5.6742e-08, 5.6552e-07, 2.0103e-09, 2.7373e-09, 1.3235e-10,\n",
      "                        6.5930e-11, 1.9144e-11, 5.8403e-08, 2.8942e-08, 3.1299e-08, 2.6330e-09,\n",
      "                        5.7060e-08, 8.3635e-10, 2.8468e-10, 2.9990e-09, 7.5186e-11, 1.5560e-09,\n",
      "                        2.5652e-10, 1.4422e-08, 2.1617e-10, 1.2071e-10, 1.8667e-10, 1.8028e-10,\n",
      "                        1.7247e-07, 1.1128e-09, 2.3489e-10, 2.2928e-10, 5.4406e-10, 1.0414e-09,\n",
      "                        5.9679e-10, 2.4117e-08, 4.2756e-12, 4.5020e-11, 1.0954e-10, 4.2461e-08,\n",
      "                        4.3185e-11, 1.1469e-09, 8.2571e-10, 6.0112e-10, 4.5804e-09, 3.3112e-08,\n",
      "                        8.7933e-09, 3.3623e-13, 2.7260e-11, 1.4559e-10, 3.8381e-10, 1.5728e-10,\n",
      "                        4.8054e-10, 7.8025e-10, 5.4906e-12, 2.3611e-10, 1.4490e-09, 4.2981e-09,\n",
      "                        5.2608e-09, 1.6851e-08, 3.2027e-11, 2.1794e-09, 3.9673e-08, 5.8257e-10,\n",
      "                        1.5349e-09, 9.9622e-11, 8.9449e-08, 2.5281e-07, 9.9172e-12, 6.8854e-11,\n",
      "                        3.0567e-09, 1.5613e-10, 4.2286e-07, 1.6151e-10, 5.9704e-09, 2.1351e-11,\n",
      "                        3.3938e-12, 2.5911e-09, 1.9829e-09, 1.8077e-10, 1.0796e-10, 1.1695e-09,\n",
      "                        4.2657e-09, 3.3592e-10, 6.3482e-09, 1.7508e-09, 5.3695e-11, 9.1582e-09,\n",
      "                        8.8203e-10, 2.1212e-08, 3.8788e-10, 1.5318e-08, 2.5164e-11, 2.5667e-10,\n",
      "                        3.6655e-09, 3.1583e-10, 3.3746e-08, 1.3673e-09, 7.9405e-13, 2.8601e-09,\n",
      "                        9.2503e-07, 7.3940e-09, 5.7676e-09, 9.8571e-11, 1.1255e-09, 1.6059e-10,\n",
      "                        6.3488e-09, 1.8630e-09, 4.2933e-09, 6.0921e-11, 5.2859e-11, 3.1138e-11,\n",
      "                        6.2277e-11, 2.0228e-09, 4.9058e-10, 3.8410e-10, 1.9653e-07, 9.1544e-10,\n",
      "                        4.3325e-07, 3.6290e-08, 5.9283e-10, 2.4265e-10, 1.8105e-11, 1.9664e-08,\n",
      "                        2.0110e-10, 2.8977e-12, 2.8953e-09, 4.8071e-11, 7.9511e-11, 3.0016e-10,\n",
      "                        4.2607e-07, 1.3521e-08, 8.9785e-10, 1.1866e-09, 1.8698e-11, 1.4613e-09,\n",
      "                        2.0701e-10, 3.6538e-10, 5.6412e-10, 7.8712e-10, 1.2317e-09, 1.6450e-07,\n",
      "                        2.0901e-10, 2.1323e-09, 9.8649e-09, 2.6229e-10, 1.0340e-08, 1.5433e-07,\n",
      "                        7.7166e-10, 1.4298e-11, 9.1605e-09, 4.0085e-10, 1.4156e-11, 5.5695e-09,\n",
      "                        9.5068e-11, 1.4022e-08, 2.5955e-10, 6.4778e-09, 3.2438e-10, 2.9416e-07,\n",
      "                        5.3999e-12, 4.4165e-11, 1.3117e-10, 6.3935e-10, 4.8900e-09, 3.6706e-08,\n",
      "                        1.8383e-06, 1.1528e-09, 5.5131e-11, 1.3114e-10, 1.7336e-08, 2.5319e-10,\n",
      "                        3.5100e-10, 6.4770e-10, 4.2503e-10, 9.6970e-11, 9.4506e-10, 1.2260e-09,\n",
      "                        2.0851e-09, 1.6473e-08, 3.4989e-07, 3.7521e-10, 2.2659e-11, 1.7785e-09,\n",
      "                        2.0704e-07, 4.1226e-11, 4.7494e-10, 2.5000e-10, 7.3404e-10, 4.6747e-09,\n",
      "                        8.5380e-12, 1.3447e-08, 3.3641e-10, 3.8482e-08, 1.9824e-12, 1.1277e-08,\n",
      "                        1.4410e-08, 8.3741e-09, 1.0047e-09, 9.4985e-09, 1.2366e-08, 5.6166e-10,\n",
      "                        2.0191e-09, 5.3750e-09, 2.3035e-09, 8.6422e-12, 6.2367e-10, 3.9367e-08,\n",
      "                        9.7779e-09, 1.8467e-11, 5.5082e-11, 7.9280e-09, 2.0550e-08, 6.2086e-11,\n",
      "                        2.5030e-10, 9.4806e-10, 1.4073e-09, 8.2167e-10, 3.0223e-10, 4.2000e-10,\n",
      "                        6.1048e-09, 1.2679e-09, 4.3404e-08, 3.2169e-09, 1.0791e-11, 2.6261e-06,\n",
      "                        5.2707e-10, 1.6470e-10, 2.3947e-10, 6.1520e-09, 1.3547e-09, 2.2801e-08,\n",
      "                        1.3057e-12, 2.2532e-09, 2.1066e-12, 1.1808e-10, 2.2422e-10, 3.9441e-09,\n",
      "                        5.2119e-07, 1.9170e-07, 2.0988e-09, 1.5213e-10, 1.9168e-11, 1.3430e-09,\n",
      "                        5.0347e-09, 5.9409e-12, 1.1721e-09, 3.4077e-10, 4.4798e-10, 7.1318e-10,\n",
      "                        3.9125e-11, 2.1642e-11, 1.2749e-09, 6.5107e-09, 1.5022e-10, 7.9540e-11,\n",
      "                        7.0555e-09, 1.9616e-11, 2.8065e-10, 4.1268e-12, 3.3638e-09, 3.8121e-10,\n",
      "                        1.3335e-09, 2.3972e-09, 3.8096e-10, 3.7802e-08, 5.9627e-11, 7.8959e-10,\n",
      "                        8.8755e-11, 4.5980e-09, 3.8252e-09, 5.6114e-09, 2.2566e-08, 5.5979e-08,\n",
      "                        4.0884e-08, 2.2632e-09, 4.7704e-09, 1.5967e-09, 2.7069e-07, 8.9959e-09,\n",
      "                        2.8314e-10, 8.6687e-13, 1.7089e-09, 1.0799e-09, 1.6137e-08, 3.7131e-10,\n",
      "                        3.1814e-10, 1.7255e-09, 3.6594e-08, 1.5092e-09, 2.0391e-09, 1.3289e-08,\n",
      "                        4.6916e-08, 2.8857e-09, 2.2752e-08, 2.0838e-10, 2.3824e-10, 1.9290e-10,\n",
      "                        5.9266e-10, 1.2575e-09, 1.4875e-12, 1.0104e-09, 1.9946e-11, 1.1080e-09,\n",
      "                        8.8880e-08, 5.9832e-10, 3.4026e-08, 9.5135e-10, 7.3775e-10, 7.1262e-08,\n",
      "                        1.3051e-10, 6.7043e-09, 1.7062e-10, 7.2376e-08, 5.5118e-11, 1.1635e-09,\n",
      "                        1.9766e-10, 1.9008e-11, 8.4608e-08, 2.9948e-11, 4.2769e-13, 3.4147e-12,\n",
      "                        4.2996e-09, 1.7012e-08, 6.2813e-10, 1.0345e-09, 1.9939e-09, 1.5677e-08,\n",
      "                        1.5597e-07, 1.3542e-11, 3.9192e-09, 1.5488e-08, 7.7585e-10, 1.1228e-10,\n",
      "                        9.0724e-10, 3.3413e-07, 2.3823e-10, 6.3847e-10, 6.8393e-09, 4.1247e-12,\n",
      "                        3.0462e-08, 3.0944e-10, 5.8460e-10, 6.2594e-08, 1.3905e-08, 5.5632e-09,\n",
      "                        8.6947e-09, 1.7184e-10, 2.2970e-11, 1.2398e-07, 5.6685e-10, 3.7461e-09,\n",
      "                        2.9900e-09, 5.8309e-11, 7.6376e-11, 3.1014e-09, 1.5507e-10, 6.9918e-09,\n",
      "                        7.4912e-08, 1.9565e-10, 9.6541e-10, 1.0460e-08, 4.4782e-09, 3.8818e-11,\n",
      "                        9.7592e-11, 1.1921e-10, 9.3363e-11, 5.3301e-12, 2.4253e-07, 1.5142e-10,\n",
      "                        3.8827e-08, 5.9628e-12, 3.3901e-10, 1.3101e-10, 2.6986e-12, 1.8315e-08,\n",
      "                        5.2576e-08, 2.9136e-10, 1.5314e-10, 1.0950e-08, 2.7612e-08, 7.5592e-10,\n",
      "                        3.2895e-09, 2.0139e-06, 4.0173e-09, 7.9455e-09, 2.3535e-11, 4.4485e-11,\n",
      "                        1.7583e-12, 4.6830e-11, 2.1056e-10, 1.8409e-09, 3.2729e-09, 1.3890e-11,\n",
      "                        4.3494e-11, 1.8824e-10, 9.5702e-07, 8.6986e-09, 2.5735e-08, 1.4306e-07,\n",
      "                        1.2765e-11, 5.2758e-08, 4.5231e-09, 1.5604e-10, 1.1184e-08, 3.3224e-09,\n",
      "                        1.4233e-10, 1.9803e-08, 3.6002e-10, 1.2086e-08, 1.5530e-07, 2.4564e-10,\n",
      "                        2.9484e-09, 4.4220e-12, 1.7426e-11, 2.5021e-11, 1.6461e-10, 5.1520e-11,\n",
      "                        8.2572e-10, 1.9292e-09, 1.3155e-10, 6.2904e-10, 3.3327e-10, 6.9456e-09,\n",
      "                        1.8285e-09, 1.2893e-09, 1.9672e-10, 2.0602e-09, 1.2926e-08, 1.3088e-09,\n",
      "                        3.6481e-09, 1.7666e-08, 6.1105e-08, 2.8380e-09, 1.1662e-08, 9.4395e-09,\n",
      "                        3.4944e-09, 3.7565e-07, 1.6100e-08, 1.1573e-06, 5.1676e-06, 6.6062e-07,\n",
      "                        4.4235e-06, 7.2685e-08, 3.8138e-08, 8.6665e-08, 3.5991e-10, 1.0953e-08,\n",
      "                        4.1678e-08, 1.8981e-08, 1.7448e-05, 7.5855e-06, 4.3588e-07, 9.0092e-07,\n",
      "                        9.9993e-01, 3.0438e-07, 7.7868e-08, 8.1716e-08, 1.5219e-11, 1.6423e-08,\n",
      "                        3.0094e-07, 5.1791e-08, 1.0623e-08, 4.7426e-11, 7.3046e-11, 1.8170e-09,\n",
      "                        5.7981e-09, 1.0674e-08, 3.4316e-08, 4.4206e-08, 2.2562e-10, 2.3125e-09,\n",
      "                        8.4880e-09, 5.0571e-10, 8.4950e-11, 6.3114e-09, 5.5009e-10, 4.6792e-08,\n",
      "                        4.0629e-08, 1.3391e-09, 2.9672e-09, 1.4919e-11, 5.1814e-10, 1.3520e-10,\n",
      "                        3.6802e-09, 1.3259e-08, 2.1610e-07, 1.1846e-07, 8.3192e-09, 7.1740e-09,\n",
      "                        2.5285e-08, 7.8507e-09, 3.7621e-10, 1.6768e-09, 1.4808e-11, 6.0783e-09,\n",
      "                        1.5095e-08, 5.5473e-09, 6.5910e-08, 1.5246e-09])\n",
      "        ) at 0x29f8fe121f0>\n",
      ") at 0x29f0bb3a370>]\n",
      "torch.Size([1, 1280])\n"
     ]
    }
   ],
   "source": [
    "## IMPORTANT: set the classifier to eval mode\n",
    "classifier.eval()\n",
    "\n",
    "imgs = data['inputs'].unsqueeze(0)\n",
    "imgs = tv_data.unsqueeze(0)\n",
    "\n",
    "with torch.no_grad():\n",
    "    # class probabilities\n",
    "    prob = classifier.forward(imgs, mode='tensor')[0]\n",
    "    # class labels\n",
    "    pred = classifier.predict(imgs)\n",
    "    # features\n",
    "    feat = classifier.extract_feat(imgs, stage='neck')[0]\n",
    "    \n",
    "print(len(prob))\n",
    "print(pred)\n",
    "print(feat.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6222126e-e439-4667-9c80-51fbecebf8dd",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  },
  "toc-autonumbering": true,
  "vscode": {
   "interpreter": {
    "hash": "00986fd0bc0afce8848933b5f2e60a5c7cb96d037ff10e4eabc895aa08e65e67"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
